package com.itany.corejava.code07_面向对象.bms;

/**
 * @author MissChen
 * @version 1.0
 * @date 2023 年11月07日 15:04
 */
public abstract class Account {
    private static int currentId=1000;//静态属性
    private int id;
    private String name;
    private String password;
    private String personId;
    private String phone;
    private double balance;
    public Account(){
        this.id=currentId++;//从1000开始，以后每次增加1
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getPersonId() {
        return personId;
    }

    public void setPersonId(String personId) {
        this.personId = personId;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public double getBalance() {
        return balance;
    }

    public void setBalance(double balance) {
        this.balance = balance;
    }

    /**
     * 存款方法
     * @param money 存入的金额
     */
    public final void deposit(double money){
        this.balance+=money;

    }

    /**
     * 取款方法，不同的子类实现方式不同，子类必须重写，因此定义为抽象方法
     * @param money
     * @return
     */
    public abstract boolean withdrawMoney(double money);

}
